   4 aspöеʵ

   һRequest        

         4-1.asp  һûϢı

<html>
<body>
<p>&nbsp; </p>
<form action="4-2.asp" method="post">
  <p>
    <input type="text"  name="tname">
  </p>
  <p>ѡԱ
    <select name="sex">
    <option value="man">
    <option value="woman">Ů
    </Select>
  </p>
  <P>
  <input type="submit" name="bs" value="ύ">

  <input type="reset" name="br"  value="д">

   <p>
 </form>
<body>
<html>








               4-2.asp  '4-1.aspĴ

<%  @1anguage="vbscript"%>
  if request.form("tname")<>"" then    'жıֵǷΪ
    dim  Strname,Strsex     
    strname=request.form("tname")  'յıеֵstrname
    strsex=request.form("sex")    'յԱ˵еֵstrsex
    if strsex="man"  then    -жԱǷΪ
        response.write("ӭ"+strname+"!")
      else 
        response.write("ӭ"+strname+"Ůʿ!")
     end if
    else       'Ϊ
       response.write("Բ!")
  end if
%>




4-3.asp,жûĿǷȷ
                   һûϢıļΪ4-3asp
  <html>
  <body>
  <font color="#0000FF" size="5" face="п">ӭĹ,дȷϢ
</font>
  <form name="form1"  method="get" action="4-4.asp">
    <p>
    <input name="xm" type="text"  size="12">
    </p>
    <p>
    <input name="k1"  type="password"  size="12">
    </p>
    <P>
    <input  type="submit"  value="ύ">
    <input  type="reset"  value="">
    </p)
    </form>
    </body>
    </html>


ϰ4-4ʹSession洢
4-4.asp£
<html>
<head><title>session</title></head>
<body>
<%
dim arr()
redim arr(4)
arr(0)="ҵļ"
arr(1)=""
session("myarray")=arr
response.redirect("sample4-4 result.asp")
%>
</body>
</html>
sample4-4 result.asp£ 
<html>
<head>
<title>session</title>
</head>
<body>
<%localarray=session("myarray")
localarray(1)=""
response.write(localarray(0)&localarray(1))
session("myarray")=localarray %>
</body>
</html>


ϰ4-5ʹApplication¼ҳ汻ʴ
4-5.asp£
<html>
<head>
<title>applicationӦʾ</title>
<%
application.lock
application("NumVisits")=application("NumVisits")+1
application.unlock
%>
</head>
<body>
ӭٱҳǱҳĵ<%=application("NumVisits")%>λÿͣ
</body>
</html>


ϰ4-6application洢û
  4-6.asp£
<%@LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>applicationӦʾ</title>
</head>
<body>
<center>
<%
application("welc")="ӭ"    '´洢ַ
application("name")="ľ"
application("inde")="ҳ"
response.write( application("welc"))   'Աı
response.write( application("name"))
response.write( application("inde "))
%>
<center>
</body>
</html>




ϰ4-7 һ򵥵ҳ
  4-7.asp£
<html>
<head>
<%  
dim n
n=0
application.lock                  'ֹͬһʱû޸Nֵ
application("n")=application("n")+1   'ȫֱNֵÿμ1
application.unlock       'Ķʹһû޸Nֵ
%>
</head>
<body>
 <fontSize=5>
ӭ<%=application("name")%>٣ǵ<%=application("n")%>λ!</font>
</body>
</html>




ϰ4.8Server.MapPathӦʾ
4-8.asp£
<HTML> 
<HEAD><TITLE>Server  MapPath ת· </TITLE></HEAD> 
<BODY>
<P align="center">Server  MapPath ת· <P> 
<TABLE ALIGN=Center BORDER=0>
<% 
Response.write "<tr><td> ĸĿ¼ǣ " 
Response.write "<td>" & Server.MapPath("/") 
Response.write "<tr><td> ǰĿ¼ϲĿ¼ǣ " 
Response.write "<td>" & Server.MapPath("../") 
Response.write "<tr><td> ǰĿ¼ǣ " 
Response.write "<td>" & Server.MapPath("./") 
Response.write "<tr><td> ǰļ·ǣ " 
Response.write "<td>" & Server.MapPath("4-16.asp") 
%> 
</BODY> 
</HTML> 

















   

